<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>教练中心 - 乒乓球培训管理系统</title>
  <link rel="stylesheet" href="../assets/css/common.css">
  <style>
    .coach-profile {
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      color: white;
      padding: 24px;
      border-radius: 8px;
      margin-bottom: 24px;
      display: flex;
      align-items: center;
      gap: 24px;
    }

    .coach-avatar-large {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.2);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 48px;
    }

    .coach-info h2 {
      margin: 0 0 8px 0;
      font-size: 28px;
    }

    .coach-info p {
      margin: 4px 0;
      opacity: 0.9;
    }

    .coach-stats {
      margin-left: auto;
      text-align: center;
      background: rgba(255, 255, 255, 0.1);
      padding: 20px;
      border-radius: 8px;
      min-width: 200px;
    }

    .stat-item {
      margin-bottom: 16px;
    }

    .stat-item:last-child {
      margin-bottom: 0;
    }

    .stat-number {
      font-size: 24px;
      font-weight: bold;
      display: block;
    }

    .stat-label {
      font-size: 12px;
      opacity: 0.8;
    }

    .pending-requests {
      background: #fff5e6;
      border: 1px solid #ffa64d;
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 24px;
    }

    .request-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid #ffa64d;
    }

    .request-item:last-child {
      border-bottom: none;
    }

    .request-info {
      flex: 1;
    }

    .request-name {
      font-weight: 600;
      margin-bottom: 4px;
    }

    .request-details {
      font-size: 12px;
      color: var(--text-muted);
    }

    .request-actions {
      display: flex;
      gap: 8px;
    }

    .student-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 20px;
    }

    .student-card {
      background: white;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 16px;
      transition: all 0.3s ease;
    }

    .student-card:hover {
      box-shadow: var(--shadow);
      transform: translateY(-2px);
    }

    .student-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
    }

    .student-avatar {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: var(--bg-light);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
    }

    .student-name {
      font-size: 16px;
      font-weight: 600;
      margin: 0 0 4px 0;
    }

    .student-info {
      font-size: 12px;
      color: var(--text-muted);
    }

    .student-stats {
      background: var(--bg-light);
      padding: 12px;
      border-radius: 6px;
      margin-bottom: 12px;
    }

    .student-stats p {
      margin: 4px 0;
      font-size: 13px;
    }

    .schedule-calendar {
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: var(--shadow);
    }

    .calendar-header {
      background: var(--primary-color);
      color: white;
      padding: 16px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .calendar-nav {
      display: flex;
      gap: 12px;
    }

    .calendar-nav button {
      background: rgba(255, 255, 255, 0.2);
      border: none;
      color: white;
      padding: 8px 12px;
      border-radius: 4px;
      cursor: pointer;
    }

    .schedule-grid {
      display: grid;
      grid-template-columns: auto repeat(7, 1fr);
      gap: 1px;
      background: var(--border-color);
    }

    .schedule-slot {
      background: white;
      padding: 12px 8px;
      text-align: center;
      font-size: 12px;
      min-height: 60px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .time-header {
      background: var(--bg-light);
      font-weight: 600;
    }

    .day-header {
      background: var(--primary-color);
      color: white;
      font-weight: 600;
    }

    .slot-free {
      background: #f0f8f0;
      color: var(--success-color);
    }

    .slot-booked {
      background: #fff5e6;
      color: var(--primary-color);
      cursor: pointer;
    }

    .slot-booked:hover {
      background: #ffe6cc;
    }

    .booking-detail {
      font-size: 10px;
      margin-top: 2px;
    }

    .earnings-summary {
      background: white;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 20px;
      margin-bottom: 20px;
    }

    .earnings-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 20px;
      text-align: center;
    }

    .earnings-item {
      padding: 16px;
      background: var(--bg-light);
      border-radius: 6px;
    }

    .earnings-amount {
      font-size: 20px;
      font-weight: bold;
      color: var(--primary-color);
      margin-bottom: 4px;
    }

    .earnings-label {
      font-size: 12px;
      color: var(--text-muted);
    }

    .review-card {
      background: white;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 16px;
    }

    .review-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }

    .review-student {
      font-weight: 600;
    }

    .review-date {
      font-size: 12px;
      color: var(--text-muted);
    }

    .review-content {
      background: var(--bg-light);
      padding: 12px;
      border-radius: 6px;
      margin-bottom: 12px;
      font-size: 14px;
      line-height: 1.4;
    }

    .review-form {
      border-top: 1px solid var(--border-color);
      padding-top: 12px;
    }

    .review-form textarea {
      margin-bottom: 8px;
    }

    .notification-badge {
      background: var(--error-color);
      color: white;
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 10px;
      position: absolute;
      top: -8px;
      right: -8px;
    }
  </style>
</head>
<body>
  <div class="container">
    <!-- 教练资料头部 -->
    <div class="coach-profile">
      <div class="coach-avatar-large">👨‍🏫</div>
      <div class="coach-info">
        <h2>李教练</h2>
        <p>中级教练 · 男 · 28岁</p>
        <p>手机：138-0000-0101 · 邮箱：coach1@example.com</p>
        <p>教学经验：5年 · 专业等级：国家二级运动员</p>
        <p>比赛成绩：2022年市级比赛第二名，2023年省级比赛第五名</p>
      </div>
      <div class="coach-stats">
        <div class="stat-item">
          <span class="stat-number">15</span>
          <span class="stat-label">指导学员</span>
        </div>
        <div class="stat-item">
          <span class="stat-number">¥150</span>
          <span class="stat-label">课时费/小时</span>
        </div>
        <div class="stat-item">
          <span class="stat-number">4.8</span>
          <span class="stat-label">学员评分</span>
        </div>
      </div>
    </div>

    <!-- 待处理请求 -->
    <div class="pending-requests" id="pendingRequests">
      <h4 style="margin: 0 0 16px 0; color: var(--primary-color);">待处理请求</h4>
      <div id="requestsList"></div>
    </div>

    <!-- 功能标签页 -->
    <div class="tab-container">
      <div class="tab-header">
        <button class="tab-btn active" onclick="switchTab('dashboard')">工作台</button>
        <button class="tab-btn" onclick="switchTab('students')" style="position: relative;">
          学员管理
          <span class="notification-badge">2</span>
        </button>
        <button class="tab-btn" onclick="switchTab('schedule')">课程安排</button>
        <button class="tab-btn" onclick="switchTab('reviews')">教学评价</button>
        <button class="tab-btn" onclick="switchTab('earnings')">收入统计</button>
      </div>

      <!-- 工作台 -->
      <div id="dashboardTab" class="tab-content tab-pane active">
        <div class="row">
          <div class="col-8">
            <div class="card">
              <div class="card-header">今日课程安排</div>
              <div class="card-body">
                <div id="todaySchedule"></div>
              </div>
            </div>
          </div>
          <div class="col-4">
            <div class="card">
              <div class="card-header">本周统计</div>
              <div class="card-body">
                <div id="weeklyStats"></div>
              </div>
            </div>
            <div class="card mt-2">
              <div class="card-header">最近消息</div>
              <div class="card-body">
                <div id="recentMessages"></div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 学员管理 -->
      <div id="studentsTab" class="tab-content tab-pane">
        <div class="action-bar">
          <h3>我的学员</h3>
          <div class="search-box">
            <input type="text" class="form-control" placeholder="搜索学员..." id="studentSearch">
            <span class="text-muted">学员数：15/20</span>
          </div>
        </div>
        <div class="student-grid" id="studentGrid"></div>
      </div>

      <!-- 课程安排 -->
      <div id="scheduleTab" class="tab-content tab-pane">
        <div class="schedule-calendar">
          <div class="calendar-header">
            <h3 style="margin: 0;">我的课表</h3>
            <div class="calendar-nav">
              <button onclick="previousWeek()">← 上周</button>
              <span id="currentWeek">2024年1月15日 - 1月21日</span>
              <button onclick="nextWeek()">下周 →</button>
            </div>
          </div>
          <div class="schedule-grid" id="scheduleGrid"></div>
        </div>
      </div>

      <!-- 教学评价 -->
      <div id="reviewsTab" class="tab-content tab-pane">
        <h3>学员评价与反馈</h3>
        <div id="reviewsList"></div>
      </div>

      <!-- 收入统计 -->
      <div id="earningsTab" class="tab-content tab-pane">
        <div class="earnings-summary">
          <h3 style="margin: 0 0 20px 0;">收入统计</h3>
          <div class="earnings-grid">
            <div class="earnings-item">
              <div class="earnings-amount">¥2,400</div>
              <div class="earnings-label">本月收入</div>
            </div>
            <div class="earnings-item">
              <div class="earnings-amount">¥600</div>
              <div class="earnings-label">本周收入</div>
            </div>
            <div class="earnings-item">
              <div class="earnings-amount">16</div>
              <div class="earnings-label">本月课时</div>
            </div>
            <div class="earnings-item">
              <div class="earnings-amount">4</div>
              <div class="earnings-label">本周课时</div>
            </div>
          </div>
        </div>

        <div class="card">
          <div class="card-header">收入明细</div>
          <div class="card-body">
            <div id="earningsDetail"></div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="../assets/js/common.js"></script>
  <script>
    // 模拟数据
    const pendingRequests = [
      {
        id: '1',
        type: 'pairing',
        studentName: '王小刚',
        studentInfo: '17岁 · 男 · 中心校区',
        requestTime: '2024-01-15 14:30:00',
        message: '希望能跟您学习乒乓球技术'
      },
      {
        id: '2',
        type: 'booking',
        studentName: '赵小丽',
        studentInfo: '预约时间：2024-01-17 15:00-16:00',
        requestTime: '2024-01-15 16:20:00',
        message: '球台2'
      }
    ];

    const myStudents = [
      {
        id: '1', name: '张小明', avatar: '👨‍🎓', age: 16, gender: '男',
        joinDate: '2023-10-15', totalClasses: 45, thisMonthClasses: 8,
        level: '中级', lastClass: '2024-01-14', rating: 4.5
      },
      {
        id: '2', name: '李小红', avatar: '👩‍🎓', age: 15, gender: '女',
        joinDate: '2023-11-20', totalClasses: 32, thisMonthClasses: 6,
        level: '初级', lastClass: '2024-01-13', rating: 4.2
      },
      {
        id: '3', name: '王小刚', avatar: '👨‍🎓', age: 17, gender: '男',
        joinDate: '2023-12-01', totalClasses: 18, thisMonthClasses: 4,
        level: '初级', lastClass: '2024-01-12', rating: 4.0
      }
    ];

    const todayClasses = [
      { time: '09:00-10:00', student: '张小明', table: '球台1', status: '已完成' },
      { time: '10:00-11:00', student: '李小红', table: '球台2', status: '已完成' },
      { time: '15:00-16:00', student: '王小刚', table: '球台1', status: '进行中' },
      { time: '16:00-17:00', student: '赵小丽', table: '球台3', status: '待开始' }
    ];

    const studentReviews = [
      {
        id: '1', student: '张小明', date: '2024-01-14', rating: 5,
        studentReview: '李教练教学很认真，发球技术讲解得很详细，练习后有明显进步。',
        coachReview: '小明学习很认真，发球动作已经基本掌握，建议多练习发球的落点控制。'
      },
      {
        id: '2', student: '李小红', date: '2024-01-13', rating: 4,
        studentReview: '今天学了反手攻球，教练很有耐心，但我还需要多练习。',
        coachReview: '小红的反手攻球基础不错，建议加强脚步移动的练习。'
      }
    ];

    const earningsData = [
      { date: '2024-01-15', student: '王小刚', amount: 150, duration: '1小时', status: '已结算' },
      { date: '2024-01-14', student: '张小明', amount: 150, duration: '1小时', status: '已结算' },
      { date: '2024-01-13', student: '李小红', amount: 150, duration: '1小时', status: '已结算' },
      { date: '2024-01-12', student: '赵小丽', amount: 150, duration: '1小时', status: '已结算' }
    ];

    function switchTab(tabName) {
      // 切换标签按钮状态
      document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
      document.querySelector(`.tab-btn[onclick*="'${tabName}'"]`).classList.add('active');

      // 切换内容面板
      document.querySelectorAll('.tab-pane').forEach(pane => pane.classList.remove('active'));
      document.getElementById(tabName + 'Tab').classList.add('active');

      // 加载对应数据
      switch(tabName) {
        case 'dashboard':
          loadDashboard();
          break;
        case 'students':
          loadStudents();
          break;
        case 'schedule':
          loadSchedule();
          break;
        case 'reviews':
          loadReviews();
          break;
        case 'earnings':
          loadEarnings();
          break;
      }
    }

    function loadPendingRequests() {
      const requestsHtml = pendingRequests.map(request => `
        <div class="request-item">
          <div class="request-info">
            <div class="request-name">
              ${request.type === 'pairing' ? '双选申请' : '预约申请'} - ${request.studentName}
            </div>
            <div class="request-details">
              ${request.studentInfo} · ${request.requestTime}
              ${request.message ? `<br/>"${request.message}"` : ''}
            </div>
          </div>
          <div class="request-actions">
            <button class="btn btn-success btn-sm" onclick="approveRequest('${request.id}', '${request.type}')">同意</button>
            <button class="btn btn-danger btn-sm" onclick="rejectRequest('${request.id}', '${request.type}')">拒绝</button>
          </div>
        </div>
      `).join('');
      
      document.getElementById('requestsList').innerHTML = requestsHtml;
      
      // 如果没有待处理请求，隐藏整个区域
      if (pendingRequests.length === 0) {
        document.getElementById('pendingRequests').style.display = 'none';
      }
    }

    function loadDashboard() {
      // 今日课程
      const scheduleHtml = todayClasses.map(cls => `
        <div style="display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #eee;">
          <div>
            <div style="font-weight: 500;">${cls.time}</div>
            <div style="font-size: 12px; color: #666;">${cls.student} · ${cls.table}</div>
          </div>
          <span class="status-badge ${cls.status === '已完成' ? 'status-success' : cls.status === '进行中' ? 'status-warning' : 'status-info'}">${cls.status}</span>
        </div>
      `).join('');
      document.getElementById('todaySchedule').innerHTML = scheduleHtml;

      // 本周统计
      const statsHtml = `
        <div style="display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee;">
          <span>本周课程</span>
          <span class="text-primary">12节</span>
        </div>
        <div style="display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee;">
          <span>本周收入</span>
          <span class="text-success">¥1,800</span>
        </div>
        <div style="display: flex; justify-content: space-between; padding: 8px 0;">
          <span>学员评分</span>
          <span class="text-warning">4.6/5.0</span>
        </div>
      `;
      document.getElementById('weeklyStats').innerHTML = statsHtml;

      // 最近消息
      const messagesHtml = `
        <div style="padding: 8px 0; border-bottom: 1px solid #eee; font-size: 12px;">
          <div style="font-weight: 500;">张小明</div>
          <div style="color: #666;">课程评价：教学很认真...</div>
          <div style="color: #999;">2小时前</div>
        </div>
        <div style="padding: 8px 0; font-size: 12px;">
          <div style="font-weight: 500;">系统通知</div>
          <div style="color: #666;">您有新的预约申请</div>
          <div style="color: #999;">1天前</div>
        </div>
      `;
      document.getElementById('recentMessages').innerHTML = messagesHtml;
    }

    function loadStudents() {
      const studentsHtml = myStudents.map(student => `
        <div class="student-card">
          <div class="student-header">
            <div class="student-avatar">${student.avatar}</div>
            <div>
              <h4 class="student-name">${student.name}</h4>
              <div class="student-info">${student.age}岁 · ${student.gender} · ${student.level}</div>
            </div>
          </div>
          <div class="student-stats">
            <p><strong>入学时间：</strong>${student.joinDate}</p>
            <p><strong>总课时：</strong>${student.totalClasses}节</p>
            <p><strong>本月课时：</strong>${student.thisMonthClasses}节</p>
            <p><strong>最后上课：</strong>${student.lastClass}</p>
            <p><strong>评分：</strong><span class="text-warning">${student.rating}/5.0</span></p>
          </div>
          <div style="display: flex; gap: 8px;">
            <button class="btn btn-primary btn-sm" onclick="viewStudentDetail('${student.id}')">查看详情</button>
            <button class="btn btn-secondary btn-sm" onclick="contactStudent('${student.id}')">发送消息</button>
          </div>
        </div>
      `).join('');
      document.getElementById('studentGrid').innerHTML = studentsHtml;
    }

    function loadSchedule() {
      const times = ['09:00', '10:00', '11:00', '14:00', '15:00', '16:00', '17:00', '18:00'];
      const days = ['时间', '周一', '周二', '周三', '周四', '周五', '周六', '周日'];
      
      let html = '';
      
      // 表头
      days.forEach((day, index) => {
        const headerClass = index === 0 ? 'time-header' : 'day-header';
        html += `<div class="schedule-slot ${headerClass}">${day}</div>`;
      });

      // 时间段
      times.forEach(time => {
        html += `<div class="schedule-slot time-header">${time}</div>`;
        
        for (let i = 0; i < 7; i++) {
          const hasBooking = Math.random() > 0.6;
          if (hasBooking) {
            const students = ['张小明', '李小红', '王小刚', '赵小丽'];
            const student = students[Math.floor(Math.random() * students.length)];
            const table = `球台${Math.floor(Math.random() * 3) + 1}`;
            html += `
              <div class="schedule-slot slot-booked" onclick="viewBookingDetail('${time}', '${student}', '${table}')">
                ${student}
                <div class="booking-detail">${table}</div>
              </div>
            `;
          } else {
            html += `<div class="schedule-slot slot-free">空闲</div>`;
          }
        }
      });

      document.getElementById('scheduleGrid').innerHTML = html;
    }

    function loadReviews() {
      const reviewsHtml = studentReviews.map(review => `
        <div class="review-card">
          <div class="review-header">
            <span class="review-student">${review.student}</span>
            <div>
              <span style="color: #ffa500;">${'★'.repeat(review.rating)}${'☆'.repeat(5-review.rating)}</span>
              <span class="review-date">${review.date}</span>
            </div>
          </div>
          <div class="review-content">
            <strong>学员评价：</strong>${review.studentReview}
          </div>
          ${review.coachReview ? `
            <div style="background: #f0f8ff; padding: 12px; border-radius: 6px; font-size: 14px;">
              <strong>我的回复：</strong>${review.coachReview}
            </div>
          ` : `
            <div class="review-form">
              <textarea class="form-control" rows="2" placeholder="回复学员评价..." id="reply_${review.id}"></textarea>
              <button class="btn btn-primary btn-sm" onclick="replyToReview('${review.id}')">回复</button>
            </div>
          `}
        </div>
      `).join('');
      document.getElementById('reviewsList').innerHTML = reviewsHtml;
    }

    function loadEarnings() {
      const columns = [
        { key: 'date', title: '日期' },
        { key: 'student', title: '学员' },
        { key: 'duration', title: '时长' },
        { 
          key: 'amount', 
          title: '收入',
          render: (value) => `<span class="text-success">¥${value}</span>`
        },
        { 
          key: 'status', 
          title: '状态',
          render: (value) => `<span class="status-badge status-success">${value}</span>`
        }
      ];

      Table.render('earningsDetail', columns, earningsData);
    }

    function approveRequest(id, type) {
      const request = pendingRequests.find(r => r.id === id);
      const message = type === 'pairing' ? '双选申请已同意' : '预约申请已同意';
      
      Utils.showMessage(message, 'success');
      
      // 从待处理列表中移除
      const index = pendingRequests.findIndex(r => r.id === id);
      if (index > -1) {
        pendingRequests.splice(index, 1);
        loadPendingRequests();
      }
    }

    function rejectRequest(id, type) {
      const request = pendingRequests.find(r => r.id === id);
      const message = type === 'pairing' ? '双选申请已拒绝' : '预约申请已拒绝';
      
      Utils.confirm('确定要拒绝这个申请吗？', () => {
        Utils.showMessage(message, 'warning');
        
        // 从待处理列表中移除
        const index = pendingRequests.findIndex(r => r.id === id);
        if (index > -1) {
          pendingRequests.splice(index, 1);
          loadPendingRequests();
        }
      });
    }

    function viewStudentDetail(id) {
      const student = myStudents.find(s => s.id === id);
      const content = `
        <div style="text-align: center; margin-bottom: 20px;">
          <div style="font-size: 48px; margin-bottom: 8px;">${student.avatar}</div>
          <h3 style="margin: 0;">${student.name}</h3>
        </div>
        <div style="line-height: 1.8;">
          <p><strong>年龄：</strong>${student.age}岁</p>
          <p><strong>性别：</strong>${student.gender}</p>
          <p><strong>技术水平：</strong>${student.level}</p>
          <p><strong>入学时间：</strong>${student.joinDate}</p>
          <p><strong>总课时：</strong>${student.totalClasses}节</p>
          <p><strong>本月课时：</strong>${student.thisMonthClasses}节</p>
          <p><strong>最后上课：</strong>${student.lastClass}</p>
          <p><strong>学员评分：</strong><span class="text-warning">${student.rating}/5.0</span></p>
        </div>
      `;
      
      const modalId = Modal.create('学员详情', content, [
        { text: '发送消息', class: 'btn-primary', onclick: `contactStudent('${student.id}')` },
        { text: '关闭', class: 'btn-secondary' }
      ]);
      Modal.show(modalId);
    }

    function contactStudent(id) {
      Utils.showMessage('消息功能开发中...', 'info');
    }

    function viewBookingDetail(time, student, table) {
      const content = `
        <div style="line-height: 1.8;">
          <p><strong>时间：</strong>${time}</p>
          <p><strong>学员：</strong>${student}</p>
          <p><strong>球台：</strong>${table}</p>
          <p><strong>状态：</strong><span class="status-badge status-success">已确认</span></p>
        </div>
        <div style="margin-top: 20px;">
          <button class="btn btn-warning" onclick="cancelBooking()">取消预约</button>
          <button class="btn btn-secondary" onclick="rescheduleBooking()" style="margin-left: 8px;">改期</button>
        </div>
      `;
      
      const modalId = Modal.create('预约详情', content, [
        { text: '关闭', class: 'btn-secondary' }
      ]);
      Modal.show(modalId);
    }

    function cancelBooking() {
      Utils.confirm('确定要取消这个预约吗？', () => {
        Utils.showMessage('预约已取消', 'success');
        loadSchedule();
      });
    }

    function rescheduleBooking() {
      Utils.showMessage('改期功能开发中...', 'info');
    }

    function replyToReview(id) {
      const reply = document.getElementById(`reply_${id}`).value;
      if (!reply.trim()) {
        Utils.showMessage('请输入回复内容', 'warning');
        return;
      }
      
      Utils.showMessage('回复已发送', 'success');
      
      // 更新评价数据
      const review = studentReviews.find(r => r.id === id);
      if (review) {
        review.coachReview = reply;
        loadReviews();
      }
    }

    function previousWeek() {
      Utils.showMessage('上周课表加载中...', 'info');
    }

    function nextWeek() {
      Utils.showMessage('下周课表加载中...', 'info');
    }

    // 页面加载时初始化
    document.addEventListener('DOMContentLoaded', function() {
      loadPendingRequests();
      loadDashboard();
    });
  </script>
</body>
</html>
